﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<% 
    DomainModel.UserInfo user = (DomainModel.UserInfo)Session["user"];
%>
<div class="w_980">
	<!--back_box-->
	<div class="back_box clearfix">
        <% 
            Html.RenderPartial("~/Views/Shared/VipCenterList.ascx");
        %>
        <div class="back_main">
        	<h3>信息修改</h3>
            <div class="main_info_box">
            <ul>
        	    <li class="li_bg"><span>*中文名：</span><input maxlength="10" name="u_name" type="text" value="<%=user.u_name%>" /><em  class="red_tip" id="spname"></em></li>
        	    <li><span>英文名：</span><input type="text" maxlength="15" name="u_enName" value="<%=user.u_enName%>"  /></li>
        	    <li class="li_bg"><span>有效证件号：</span><input type="text" maxlength="20" style="width:270px" value="<%=user.u_papers%>"  name="u_papers" /></li>
        	    <li><span>*出生日期：</span><input type="text" name="u_birthday" class="date" value="<%=user.u_birthday%>"  /><em class="red_tip" id="spbirthday"></em></li>
        	    <li class="li_bg"><span>*性别：</span><label class="radio_style"><input name="u_sex" type="radio" value="0" <%=(user.u_sex==0?"checked":"") %> />男</label><label class="radio_style"><input name="u_sex" type="radio" value="1" <%=(user.u_sex==1?"checked":"") %> />女</label></li>
        	    <li><span>*在读学校：</span><input name="u_school" maxlength="50" type="text" style="width:330px;" value="<%=user.u_school%>"  /><em class="red_tip" id="spschool"></em></li>
        	    <li class="li_bg"><span>在读班级：</span><input maxlength="10" name="u_class" type="text"  value="<%=user.u_class%>"  /></li>
                <li class="li_bg"><span>入学前英语基础：</span><input maxlength="100" name="u_english" type="text" value="<%=user.u_english%>"  /></li>
            </ul>
            <ul>
        	    <li class="li_bg"><span>家长1姓名：</span><input maxlength="10" name="u_patriarchName1" type="text" value="<%=user.u_patriarchName1%>"  /></li>
        	    <li><span>家长1与学员关系：</span><input type="text" maxlength="25" name="u_raletion1" value="<%=user.u_raletion1%>"  /></li>
        	    <li class="li_bg"><span>*联系电话1：</span><input  maxlength="20" name="u_tel1" type="text" value="<%=user.u_tel1%>"  /><em class="red_tip" id="sptel1"></em></li>
        	    <li><span>家长1年龄：</span><input type="text" name="u_patriarchAge1" maxlength="3" value="<%=user.u_patriarchAge1%>"  /><em class="red_tip" id="sppatriarchAge1"></em></li>
        	    <li class="li_bg"><span>家长1学历：</span><input type="text" maxlength="10" name="u_patriarchEducation1" value="<%=user.u_patriarchEducation1%>"  /></li>
        	    <li><span>家长1从事行业：</span><input type="text" name="u_job1" maxlength="20" value="<%=user.u_job1%>"  /></li>
        	    <li class="li_bg"><span>家长1职位：</span><input type="text" name="u_post1" value="<%=user.u_post1%>"   maxlength="10"/></li>
            </ul>
            <ul>
        	    <li class="li_bg"><span>家长2姓名：</span><input maxlength="10" name="u_patriarchName2" value="<%=user.u_patriarchName2%>"  type="text" /></li>
        	    <li><span>家长2与学员关系：</span><input type="text" maxlength="25" name="u_raletion2" value="<%=user.u_raletion2%>"  /></li>
        	    <li class="li_bg"><span>联系电话2：</span><input name="u_tel2" value="<%=user.u_tel2%>"  maxlength="20" type="text" /></li>
        	    <li><span>家长2年龄：</span><input type="text" name="u_patriarchAge2" value="<%=user.u_patriarchAge2%>"  maxlength="3" /><em class="red_tip" id="sppatriarchAge2"></em></li>
        	    <li class="li_bg"><span>家长2学历：</span><input type="text" name="u_patriarchEducation2" value="<%=user.u_patriarchEducation2%>"  maxlength="10" /></li>
        	    <li><span>家长2从事行业：</span><input type="text" name="u_job2" value="<%=user.u_job2%>"  maxlength="20" /></li>
        	    <li class="li_bg"><span>家长2职位：</span><input type="text" name="u_post2" value="<%=user.u_post2%>"  maxlength="10" /></li>
            </ul>
            <ul>
        	    <li class="li_bg"><span>住址：</span><input type="text" maxlength="100" style="width:430px;" name="u_address" value="<%=user.u_address%>"  /></li>
        	    <li><span>*邮箱地址：</span><input maxlength="30" type="text" name="u_email" value="<%=user.u_email%>"  style="width:220px;" /><em class="red_tip" id="spemail"></em></li>
            </ul>
                    <div class="reg_btn_box">
        	            <a href="javascript:void(0);" id="btnReg" class=" btn_reg btn_01">保存</a>
                    </div>
            </div>

    </div>
    </div>
</div>
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/Scripts/form.js" type="text/javascript"></script>
<script src="/Scripts/datepicker/js/jquery-ui-1.7.custom.min.js" type="text/javascript"></script>
<link href="/Scripts/datepicker/css/smoothness/jquery-ui-1.7.custom.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
    $(function () {
        $('.date').datepicker({
            numberOfMonths: 1,
            showButtonPanel: true,
            changeMonth: true,
            yearRange: '-40:+1', changeYear: true
        });
        $("#btnReg").click(function () {
            var userinfo = { u_id: <%=user.u_id %>,u_name: "", u_enName: "",u_papers: "", u_birthday: new Date(),u_sex: 0, u_school: "", u_class: "", u_english: "", u_patriarchName1: "", u_raletion1: "", u_tel1: "", u_patriarchAge1: 0, u_patriarchEducation1: "", u_job1: "", u_post1: "", u_patriarchName2: "", u_raletion2: "", u_tel2: "", u_patriarchAge2: 0, u_patriarchEducation2: "", u_job2: "", u_post2: "", u_address: "", u_email: ""};
            var flag = true;
            if ($("input[name=u_name]").val().replace(/\s+/g, "") == "") {
                $("#spname").html("中文名不能为空");
                flag = false;
            }
            else {
                $("#spname").html("");
            }
            if ($("input[name=u_birthday]").val().replace(/\s+/g, "") == "") {
                $("#spbirthday").html("出生日期不能为空");
                flag = false;
            }
            else {
                $("#spbirthday").html("");
            }
            if ($("input[name=u_school]").val().replace(/\s+/g, "") == "") {
                $("#spschool").html("在读学校不能为空");
                flag = false;
            }
            else {
                $("#spschool").html("");
            }
            if ($("input[name=u_tel1]").val().replace(/\s+/g, "") == "") {
                $("#sptel1").html("联系电话1不能为空");
                flag = false;
            }
            else {
                $("#sptel1").html("");
            }
            if ($("input[name=u_email]").val().replace(/\s+/g, "") == "") {
                $("#spemail").html("电子邮箱不能为空");
                flag = false;
            }
            else {
                if (!/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test($("input[name=u_email]").val())) {
                    $("#spemail").html("电子邮箱格式不正确");
                    flag = false;
                } else {
                    $("#spemail").html("");
                }
            }
            if ($("input[name=u_patriarchAge1]").val().replace(/\s+/g, "") != "") {
                if (!/^\d{0,3}$/.test($("input[name=u_patriarchAge1]").val())) {
                    $("#sppatriarchAge1").html("家长1年龄格式不正确");
                    flag = false;
                }
                else {
                    $("#sppatriarchAge1").html("");
                }
            }
            else {
                $("#sppatriarchAge1").html("");
            }
            if ($("input[name=u_patriarchAge2]").val().replace(/\s+/g, "") != "") {
                if (!/^\d{0,3}$/.test($("input[name=u_patriarchAge2]").val())) {
                    $("#sppatriarchAge2").html("家长2年龄格式不正确");
                    flag = false;
                }
                else {
                    $("#sppatriarchAge2").html("");
                }
            }
            else {
                $("#sppatriarchAge2").html("");
            }
            if (!flag) {
                return false;
            }
            userinfo.u_name = $("input[name=u_name]").val();
            userinfo.u_enName = $("input[name=u_enName]").val();
            userinfo.u_papers = $("input[name=u_papers]").val();
            userinfo.u_birthday = $("input[name=u_birthday]").val();
            userinfo.u_sex = $("input:[name=u_sex]:radio:checked").val();
            userinfo.u_school = $("input[name=u_school]").val();
            userinfo.u_class = $("input[name=u_class]").val();
            userinfo.u_english = $("input[name=u_english]").val();
            userinfo.u_patriarchName1 = $("input[name=u_patriarchName1]").val();
            userinfo.u_raletion1 = $("input[name=u_raletion1]").val();
            userinfo.u_tel1 = $("input[name=u_tel1]").val();
            userinfo.u_patriarchAge1 = $("input[name=u_patriarchAge1]").val();
            userinfo.u_patriarchEducation1 = $("input[name=u_patriarchEducation1]").val();
            userinfo.u_job1 = $("input[name=u_job1]").val();
            userinfo.u_post1 = $("input[name=u_post1]").val();
            userinfo.u_patriarchName2 = $("input[name=u_patriarchName2]").val();
            userinfo.u_raletion2 = $("input[name=u_raletion2]").val();
            userinfo.u_tel2 = $("input[name=u_tel2]").val();
            userinfo.u_patriarchAge2 = $("input[name=u_patriarchAge2]").val();
            userinfo.u_patriarchEducation2 = $("input[name=u_patriarchEducation2]").val();
            userinfo.u_job2 = $("input[name=u_job2]").val();
            userinfo.u_post2 = $("input[name=u_post2]").val();
            userinfo.u_address = $("input[name=u_address]").val();
            userinfo.u_email = $("input[name=u_email]").val();

            $.post("/login/saveUserInfo.html", { userinfo: $.toJSON(userinfo) }, function (dta) {
                    alert('修改成功');
            });
        });
    });

</script>

</asp:Content>
